package com.paopao.loansheet.mapper;

import com.paopao.domain.ItemInfoBean;
import com.paopao.mapper.MySqlprovider;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ItemInfoMapper {
    @Insert("insert into swans_project(project_name, project_no, standard, scale, type, create_time, update_time, status) " +
            "values(#{projectName}, #{projectNo}, #{standard}, #{scale}, #{type}, #{createTime}, #{updateTime}, #{status})")
    public Integer addItemInfo(ItemInfoBean bean);

    @Delete("delete from swans_project where id = #{id}")
    public Integer deleteItemInfo(int id);

    @Update("update swans_project set project_name=#{projectName}, project_no=#{projectNo}, standard=#{standard}, scale=#{scale}, " +
            "type=#{type}, create_time=#{createTime}, update_time=#{updateTime}, status=#{status} where id=#{id}")
    public Integer editItemInfo(ItemInfoBean bean);

    @Select("select project_name as projectName, project_no as projectNo, standard, scale, type, create_time as createTime, " +
            "update_time as updateTime, status from swans_project where id = #{id}")
    @Results({ @Result(column = "creatTime", property = "creatTime",typeHandler=com.paopao.domain.CalendarTypeHandler.class),
            @Result(column = "updateTime", property = "updateTime",typeHandler=com.paopao.domain.CalendarTypeHandler.class) })
    public ItemInfoBean selectItemInfoByid(int id);

    @SelectProvider(type = MySqlprovider.class, method = "getItemListSql")
    @Results({ @Result(column = "creatTime", property = "creatTime",typeHandler=com.paopao.domain.CalendarTypeHandler.class),
            @Result(column = "updateTime", property = "updateTime",typeHandler=com.paopao.domain.CalendarTypeHandler.class) })
    public List<ItemInfoBean> getItemList(ItemInfoBean itemInfoBean);
}
